package com.template.controller;

import com.template.dto.Meal;
import com.template.result.Result;
import com.template.service.PageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
//@RequestMapping("/page")
public class PageController {
    @Autowired
    private PageService pageService;

    @PostMapping("/page/pageCount")
    public Result pageCount(@RequestParam Long userId, String pageName){
        pageService.pageCount(userId,pageName);
        System.out.println(userId+pageName);
        return Result.success();
    }

    @GetMapping("/page/pageCount")
    public Result getPageCount(@RequestParam Long userId){
        Meal meal=pageService.getPageCount(userId);
        return Result.success(meal);
    }

    @PostMapping("/addPojoClass")
    public Result addPojoClass(@RequestParam String name){
        System.out.println(name);
        pageService.addPojo(name);
        return Result.success("新页面"+name+"添加成功");
    }
}
